/**
 * Created by Administrator on 15-11-8.
 */
window.onload=function(){
    //var id = $.getUrlParam("id");
    var url = getUrl();
    var userid=getUserId();
$.jsonp({
    url: 'http://'+url+'/api/msgcenter/msgcenter_list',
    data: {userId:userid},
    callbackParameter: "callback",
    success: function (data, textStatus, xOptions) {
        //console.log(data);
        $.each(data.arrays,function(index,ele){
            console.log(ele.createTime);
          var day=getTime(ele.createTime);
          var yy=(day.substr(5,2))
            var rr=(day.substr(8,2))
            var yr=yy+"月"+rr+"日"
            //return   year+"-"+(month>=10?month:"0"+month)+"-"+(date>=10?date:"0"+date);
            console.log(rr)
            var html = '<li>' +
                '<a href="xiaoxizhongxin_detail.html">' +
                '<h2>'+ele.name+'</h2>' +
                '<p class="ui-txt-muted">'+yr+'</p>' +
                '<div class="ui-push-pic">' +
                '<img src="'+ele.image+'" alt="">' +
                '</div>' +
                '<p class="ui-txt-muted ui-push-summary">'+ele.content+'</p>' +
                '<p>'+ele.memo+'</p>' +
                '</a>' +
                '</li> ';
            $("#xxzx").append(html);

        })
    },
    error: function (xOptions, textStatus) {

    }
});

}
function getTime(t){
    var nt = t*1000;
    var n = new Date(nt);
    return formatDate(n);
}
function formatDate(now)   {
    var   year=now.getFullYear();
    var   month=now.getMonth()+1;
    var   date=now.getDate();
    return   year+"-"+(month>=10?month:"0"+month)+"-"+(date>=10?date:"0"+date);
}